package com.demo.common.exception;

/**
 * 自定义异常类：
 * 业务异常，异常信息会返回到前端展示给用户
 *
 */
public class BusinessException extends RuntimeException {
    private static final long serialVersionUID = -5770538329754222306L;

    private int code = 1;

    public BusinessException(int code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
    }

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(Throwable cause) {
        super(cause);
    }

    public BusinessException(int code, String message) {
        super(message);
        this.code = code;
    }

    public int getCode() {
        return this.code;
    }
}
